﻿/*----------------------------------------------------------------
//Copyright (C) 2012 赵国伟
//文件功能描述：库存管理客户端脚本
//创建人：赵国伟
//生成时间：2012-06-10 16:55:40
//----------------------------------------------------------------*/
var AjaxServerUrl = "/Manage/AS/StoresCommon.aspx";

///执行搜索
function GoToSearch() {
    var url = "GoodsStocksManage.aspx?";
    url += "keyWords=" + escape($("#txtKeyWords").val().trim());
    url += "&CategoryID=" + $("#ddlCategoryOfSearch").val();
    url += "&BrandID=" + $("#ddlBrandOfSearch").val();
    url += "&StoreID=" + $("#ddlStoreOfSearch").val();
    url += "&Cond=" + $("#ddlCond").val();
    url += "&Quantity=" + $("#txtQuantityOfSearch").val();
    location.href = url;
}




function ViewRecords(goodsId, storeId) {
    $.ajax(
    {
        type: "Get",
        url: AjaxServerUrl + "?Action=QueryStockRecords&GoodsID=" + goodsId + "&StoreID=" + storeId + "&tttt=" + Math.random(),
        dataType: "json",
        success: function (data) {
            var html = new Array();
            html.push("<form>");
            html.push("  <table width=\"850\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table\">");
            html.push("  <tr>");
            html.push("    <td colspan=\"10\" class=\"HeadTitle\">&gt;&gt;进出货记录 </td>");
            html.push("  </tr>");
            html.push("  <tr>");
            html.push("    <td align=\"center\">编号</td>");
            html.push("    <td align=\"center\">商品名称</td>");
            html.push("    <td align=\"center\">所在库房</td>");
            html.push("    <td width=\"70\" align=\"center\">是否入库</td>");
            html.push("    <td width=\"70\" align=\"center\">日期</td>");
            html.push("    <td align=\"center\">记录类型</td>");
            
            html.push("    <td align=\"center\">数量</td>");
            
            html.push("    <td align=\"center\">备注</td>");
            html.push("    </tr>");

            if (data != null) {
                for (var i = 0; i < data.length; ++i) {

                    html.push("  <tr>");
                    html.push("    <td align=\"center\">" + (i + 1) + ".</td>");
                    html.push("    <td align=\"center\"><a href=\"/Show.aspx?GoodsID=" + data[i].RecordInfo._goodsid + "\" target=\"_blank\">" + data[i].GoodsName + "</a></td>");
                    html.push("    <td align=\"center\">" + data[i].StoreName + "</td>");
                    html.push("    <td align=\"center\">" + (data[i].RecordInfo._isenter ? "入库" : "出库") + "</td>");
                    html.push("    <td align=\"center\">" + ConvertJsonDatetoToLocateDate(data[i].RecordInfo._recorddate) + "</td>");
                    html.push("    <td align=\"center\">" + data[i].RecordInfo._recordtype + "</td>");

                    html.push("    <td align=\"center\" class=\"blue bold\">" + data[i].RecordInfo._quantity + "</td>");

                    html.push("    <td align=\"center\">" + data[i].RecordInfo._memo + "&nbsp;</td>");
                    html.push("    </tr>");
                }
            }
            else {
                html.push("<tr><td colspan=\"8\" align=\"center\" class=\"red bold\">[ 该商品还没有任何进出货记录]</td></tr>");
            }
            html.push("</table>");
            html.push("</form>");
            GetPopupDiv(800, 800, "#e2e2e2", "商品进出记录", html.join(""));

        }

    });

}

















